﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Gestion_Incidents_SI
{
    public partial class mainForm : Form
    {

        //TODO: Create a function to open MDIChilds

        public mainForm()
        {
            InitializeComponent();
        }

        private void actionsToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void listeDesInterventionsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            
                                  
        }

            
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            Form activeChild = this.ActiveMdiChild;

            if (activeChild != null)
            {
                activeChild.Close();
            }
            else
            {
                this.Close();
            }
        }

        private void nouvelleInterventionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            
        }

        private void toolStripMenuItem2_Click(object sender, EventArgs e)
        {

        }

        private void toolStripMenuItem3_Click(object sender, EventArgs e)
        {
            listeInterventions childForm = null;

            foreach (Form f in this.MdiChildren)
            {
                if (f is listeInterventions)
                {
                    childForm = (listeInterventions)f;
                    break;
                }
            }

            if (childForm != null)
            {
                childForm.Show();
                childForm.Focus();
            }
            else
            {
                childForm = new listeInterventions();
                childForm.MdiParent = this;
                childForm.Show();
                childForm.Focus();
            }
        }

        private void toolStripMenuItem4_Click(object sender, EventArgs e)
        {
            nouvelleIntervention childForm = null;

            foreach (Form f in this.MdiChildren)
            {
                if (f is nouvelleIntervention)
                {
                    childForm = (nouvelleIntervention)f;
                    break;
                }
            }

            if (childForm != null)
            {
                childForm.Show();
                childForm.Focus();
            }
            else
            {
                childForm = new nouvelleIntervention();
                childForm.MdiParent = this;
                childForm.Show();
                childForm.Focus();
            }
        }

        private void mainForm_Load(object sender, EventArgs e)
        {

        }
    }
}
